<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/CMS.Master" Inherits="System.Web.Mvc.ViewPage<MvcCms.Web.ViewModels.BackOfficeModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Mvc Cms -
    <%=ViewData["PageTitle"]%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <link href="/content/ckeditor.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="content-container-cms">
        <%if (Model._Portal.UsesWikiForCMS)
          { %>
        <div>
            This Portal Uses <a href="/forums/faq">Wiki Code</a> Instead of HTML - Edit In Source
            Mode</div>
        <%} %>
        <div class="content-container-inner-cms">
            <div class="content-left-cms">
                <div class="cms-left-menu">
                    <div class="cmseditor-title" title="Categories create the navigation structure of the site.  You may have alternate versions ongoing for each category.  Each category must have a unique name.">
                        Categories</div>
                    <div class="cmsbuttons">
                        <table>
                            <tr>
                                <td>
                                    <img class="cmsicon" title="Move Category Up" onclick="CategoryMenu('up')" alt="up"
                                        src="../../Content/images/CMSEditor/up.jpg" />
                                </td>
                                <td>
                                    <img class="cmsicon" title="Move Category Down" onclick="CategoryMenu('down')" alt="down"
                                        src="../../Content/images/CMSEditor/down.jpg" />
                                </td>
                                <td>
                                    <a href="managecontentcategories">
                                        <img class="cmsicon" title="Add Category" alt="plus" border="0" src="../../Content/images/CMSEditor/plus.jpg" /></a>
                                </td>
                                <td>
                                    <a href="managecontentcategories">
                                        <img class="cmsicon" title="Delete Category" alt="minus" border="0" src="../../Content/images/CMSEditor/minus.jpg" /></a>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div>
                </div>
                <div class="container">
                    <div class="container-top">
                    </div>
                    <div id="container-content-category" class="container-content-cms">
                        <ul id="treeview">
                            <%Html.RenderPartial("ControlsCMS/ItemControl", Model._ContentCategories); %>
                        </ul>
                    </div>
                    <div class="container-bottom">
                    </div>
                </div>
                <div class="cms-left-menu">
                    <div class="cmseditor-title" title="Here you may have alternate versions for each category.  For alternate versions of sub pages just use slightly different names and only enable the desired version.">
                        Versions <a href="javascript:void(0);" class="setversionlink" title="Click here to switch the current published version for a category."
                            onclick="SetVersion()">Set Version</a></div>
                    <div class="cmsbuttons">
                        <table>
                            <tr>
                                <td>
                                    <img class="cmsicon" title="Add New Version" onclick="VersionMenu('plus')" alt="plus"
                                        src="../../Content/images/CMSEditor/plus.jpg" />
                                </td>
                                <td>
                                    <img class="cmsicon" title="Delete Version" onclick="VersionMenu('minus')" alt="minus"
                                        src="../../Content/images/CMSEditor/minus.jpg" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="container">
                    <div class="container-top">
                    </div>
                    <div id="container-content-versions" class="container-content-cms">
                        <table id="VersionPageList" class="PageList">
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                    <div class="container-bottom">
                    </div>
                </div>
                <div class="cms-left-menu">
                    <span class="cmseditor-title" title="Sub Pages appear in the in page navigation and are grouped for each category.  While in a category the sub pages for that category appear in the in page menu.">
                        Sub Pages</span><div class="cmsbuttons">
                            <table>
                                <tr>
                                    <td>
                                        <img class="cmsicon" title="Move Page Up" onclick="SubPageMenu('up')" alt="up" src="../../Content/images/CMSEditor/up.jpg" />
                                    </td>
                                    <td>
                                        <img class="cmsicon" title="Move Page Down" onclick="SubPageMenu('down')" alt="down"
                                            src="../../Content/images/CMSEditor/down.jpg" />
                                    </td>
                                    <td>
                                        <img class="cmsicon" title="Add New Page" onclick="SubPageMenu('plus')" alt="plus"
                                            src="../../Content/images/CMSEditor/plus.jpg" />
                                    </td>
                                    <td>
                                        <img class="cmsicon" title="Delete Page" onclick="SubPageMenu('minus')" alt="minus"
                                            src="../../Content/images/CMSEditor/minus.jpg" />
                                    </td>
                                </tr>
                            </table>
                        </div>
                </div>
                <div class="container">
                    <div class="container-top">
                    </div>
                    <div id="container-content-subpage" class="container-content-subpage">
                        <table id="SubPageList" class="PageList">
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                    <div class="container-bottom">
                    </div>
                </div>
                <div class="side-bucket">
                    <div class="side-bucket-top">
                    </div>
                    <%Html.RenderPartial("ControlsSidebar/UserSidebar");%>
                    <div class="side-bucket-bottom">
                    </div>
                </div>
            </div>
            <div class="content-main-cms">
                <%= Html.ValidationSummary("Unsuccessful. Please correct the errors and try again.") %>
                <div class="cmsnotify">
                    <div id="isloading" class="isloading">
                    </div>
                    <span id="msgsuccess" class="msgsuccess-cms">
                        <img alt="spacer" src="/Content/images/1x25.gif" />
                    </span>
                </div>
                <div class="fieldrow">
                    <label for="Name" title="This will be used to create the url slug, it must be unique to category and page names.  The title will also be used in the page title shown in the browser and in search results.  This all applies to subpages, for category pages it is only informational and the category name will provide the results title and the url.">
                        Name:</label>
                    <%= Html.TextBox("Name", "", new { @class = "required" })%>
                    <label for="Description" title="This is for internal use only, you may put a description here to identify the page for internal use.  When editing with live writer the summary well help to identify pages and versions.">
                        Summary:</label>
                    <input type="text" id="Summary" class="description" />
                    <label for="Description" title="This will be used as the meta description tag for the page.">
                        Description:</label>
                    <input type="text" id="Description" class="description" />
                    <label for="Description" title="Enter comma seperated list of Divs to have weighted widget's loaded at page load.">
                        Weighted Divs:</label>
                    <input type="TargetDivsForWeightedContent" id="TargetDivsForWeightedContent" />
                </div>
                <div>
                    <div id="subpage-options" class="sp-options">
                    </div>
                    <div id="contributors">
                        <hr />
                        <label for="contributor" title="The contributor that will be given write access to this document.">
                            Assigned Contributor:
                        </label>
                        <%= Html.DropDownList("UserID")%>
                        <div class="cmsright">
                            <input type="button" onclick="SavePage()" value="Save Page" /></div>
                    </div>
                </div>
                <div class="editor">
                    <%= Html.TextArea("Body", "", new { @class = "mceEditor" })%>
                </div>
                <div class="bottominfo">
                    Hover over labels for help<br />
                    If you change the title of a version or sub page it will change the url for the
                    page also. Although no application restart is required for this it will break links
                    to the page not generated by the cms.
                </div>
                <div id="languages" class="languages">
                    <%Html.RenderPartial("ControlsCMS/LanguagesControl", Model._Languages); %>
                </div>
            </div>
        </div>
        <div class="clear">
        </div>
    </div>
    <%=Html.Hidden("pageholder", "")%>
    <%=Html.Hidden("defaultLanguageId", Model._Portal.DefaultLanguage.LanguageID)%>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ScriptContent" runat="server">

    <script type="text/javascript" src="/scripts/ckeditor/ckeditor.js"></script>

    <script type="text/javascript" src="/scripts/MvcCmsImageManager.js"></script>

    <script src="/scripts/ckeditor.js" type="text/javascript"></script>

    <script type="text/javascript">
        var editor;
        var allowPageWikiHtmlSwitch = false;
        <%
            if (Model._Portal.AllowPageWikiHtmlSwitch)
            {%>
                allowPageWikiHtmlSwitch = true;
          <%}
        %>
        
    </script>

    <script src="/Scripts/jquery.treeview.min.js" type="text/javascript"></script>

    <script src="/Scripts/CMSEditor.js" type="text/javascript"></script>

    <script type="text/javascript">
        $().ready(function() {
            $("#treeview").treeview();
        });
        LoadCategoryPageList();
        <%
        if (!Model._Portal.UsesWikiForCMS)
        { 
        %>
            editor = CKEDITOR.replace('Body',
		        {
		            height: "180"
		        });
            MvcCmsImages.SetupCKEditor(editor);
            LoadFirstPage();
        <%
        }
        %>
    </script>

</asp:Content>
